#include <iostream>
#include <cstdio>
#include <cassert>

#define N 101

int data[N]; 
int dtop; 

char s[N]; 

int main()
{
	char *p; 
	int d, a, b; 
	
	//freopen("p1149.in", "r", stdin); 
	
	scanf("%s", s); 
	
	for (p=s; *p!='@'; ) {
		if (*p>='0'&&*p<='9') {
			d = 0; 
			for (;*p>='0'&&*p<='9'; p++) {
				d *= 10; 
				d += (*p-'0'); 
			}
		} else if (*p=='.') {
			//printf("push %d\n", d); 
			data[dtop++] = d; 
			p++; 
		} else if (*p=='+' || *p=='-' || *p=='*' || *p=='/') {
			b = data[--dtop]; 
			a = data[--dtop]; 
			d = *p=='+' ? a+b : (
				*p=='-' ? a-b : (
				*p=='*' ? a*b : (
				*p=='/' ? a/b : -1 ))); 
			//printf("%d %c %d = %d\n", a, *p, b, d); 
			data[dtop++] = d; 
			p++; 
		} else {
			assert(0); 
		}
	}
	printf("%d\n", data[0]); 
	
	return 0; 
}

